﻿Imports LinhKienMayTinh.CommonMethods

Public Class NewsDetailControl
    Inherits System.Web.UI.UserControl

    Protected dsSource As DataSet
    Public Property DataSource() As DataSet
        Get
            Return dsSource
        End Get
        Set(ByVal value As DataSet)
            dsSource = value
        End Set
    End Property

    Protected _ListTag As List(Of String)
    Public Property ListTag As List(Of String)
        Get
            Return _ListTag
        End Get
        Set(value As List(Of String))
            _ListTag = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            If IsNothing(DataSource) = False Then
                With DataSource.Tables(0).Rows(0)
                    Me.lbUdDate.Text = DirectCast(Nz(.Item("UD_DATE"), ""), DateTime).ToString("dd/MM/yyyy HH:mm")
                    Me.lbName.Text = Nz(.Item("TITLE"), "")
                    Me.lbSummary.Text = Nz(.Item("SUMMARY"), "")
                    Me.ltContent.Text = Nz(.Item("CONTENT"), "")

                    Me._ListTag = Nz(.Item("TAG"), "").ToString().Split(",").ToList()

                    '' Tạo động meta tag Description và Keywords.
                    Dim meta As HtmlMeta = Page.Header.FindControl("Description")
                    If meta IsNot Nothing Then
                        meta.Content = Nz(.Item("SUMMARY"), "")
                    End If

                    meta = Page.Header.FindControl("Keywords")
                    If meta IsNot Nothing Then
                        meta.Content = Nz(.Item("TITLE"), "")
                    End If
                End With
            End If
        Catch ex As Exception
            Server.Transfer("~/Pages/Error.aspx")
        End Try
    End Sub

    
End Class